package iot

import (
	"gorm.io/gorm"
	"iot-base/common/dbobj"
)

type (
	ThingMaintainInfo dbobj.ThingMaintainInfo

	ThingMaintainInfoModel struct {
		db *gorm.DB
	}
)

func NewThingMaintainInfoModel(db *gorm.DB) *ThingMaintainInfoModel {
	return &ThingMaintainInfoModel{
		db: db,
	}
}

func (t *ThingMaintainInfoModel) Insert(data *ThingMaintainInfo) error {
	return t.db.Model(&ThingMaintainInfo{}).Create(data).Error
}

func (t *ThingMaintainInfoModel) DeleteMap(param map[string]interface{}) error {
	return t.db.Where(param).Delete(&ThingMaintainInfo{}).Error
}
